#ifndef _LIST_H_
#define _LIST_H_

#include <stdbool.h>

typedef struct _LIST_t
{
    void* _body;
    int   (*push_front)(struct _LIST_t* list, void* data, int len);
    int   (*push_back)(struct _LIST_t* list, void* data, int len);
    void* (*front)(struct _LIST_t* list);
    void* (*back)(struct _LIST_t* list);
    void  (*pop_front)(struct _LIST_t* list);
    void  (*pop_back)(struct _LIST_t* list);
    void  (*erase)(struct _LIST_t* list, void* data); // O(n)
    bool  (*empty)(struct _LIST_t* list);
    int   (*size)(struct _LIST_t* list);
    void   (*clear)(struct _LIST_t* list);
    void  (*destruct)(struct _LIST_t** list);
}LIST_t;

/*
* @param max_num : 队列最大深度
* @param max_len : 队列最大宽度
* @param data_free : 用户自定义释放内存函数
*/
extern LIST_t* create_list(int max_num, int max_len, void (*data_free)(void*));

#endif
